removed list comprhensions by refactor

speeds up program