WIP: separated controller and UI

mostly untested