commented init function
moved functions to top of code