Remove unecessary stuff
Simplify loops