Controllers refactoring

just tiny bits of refactoring..
- methods visibility, db queries and functions moved to subs..