Moved some code into camera class.
Added comments