More refactoring of camera script (still broken)