Moved update and render func from main loop