Optimized the code for handling the lists

3 jobs for feature/optimize_list in 1 minute and 56 seconds (queued for 52 seconds)
Status Name Job ID Coverage
  Test
passed linters #67039

00:00:48

passed tests #67038

00:01:08

failed linters #67037

00:01:05