Fix build problems.

This pull request get the application to build, but there still remain problems with it working, which I'm continuing to investigate.