Refactor studies_controller