Fix and tidy up the OS X app

Redone pull request #613 for rauix to be cleaner. Does not include
spaces-to-tabs or other formatting changes that #613 had.
Merge pull request #631 from portablejim/osx-patch1

Fix and tidy up the OS X app