Reorded methods in main js file to make it more readable