code cleanup
optimzied main view
optimized database handling
Revert "code cleanup"

This reverts commit de7e75cd58dfddd40256096bd89e1dc99461905a.
optimized widget