Implemented global AJAX error handling.

Merged App code into a single file.