Fixes, reorganizing, and slight changes to render loop