abstracting execution flow inside game loop