Fixed a lot of bugs and improved UI.