Added ui, fixed lots of bugs