Controllers code refactored