Added main loop implementation. Added basic ui.