Moved the order of operations to make things more logical and smooth, also killed an extraneous call to render()