Removed unused functions and changed handling of projection matrix.