changed all the init code and loops now have their own methods