Fixed several bugs and tweaked the UI