Replacing loop with generator
Renaming variables
removing unneeded code