Pragmatic approach to #151. Improves user experience, but better understanding of the underlying problem would be good.
Minor style tweaks to source code and UI (all files should end with a newline).