Code cleanup, fix #1, ui-improvements