restructured application. added debug logs. everything is more decoupled now.