refactor message controller and student.rb