Code style fixes in main controller
Improvements to rating setting logic