removing unecessary loops