Initial UI

Initial UI and a bit of javascript refactoring.