Refactoring display controller

here we go again :)

- moved db queries and functions to related subs.
- methods visibility
- fixed some bugs due to not initialized vars..