Lots of refactoring and ui changes.