Refactored rendering into its own object. Removed constants to move away from globals.