Merged Dave's changes

Various bug fixes and UI improvements