Refactored controllers. (thanx Andriy Yacenko)