Refactor ratings controller