WIP. Code cleanup. Started rewrite of widgets as methods.