working after refactoring, had to return camera object from init function