Updates to app code

* Added app.h
* modified code to make it fit more in line w/ sample code
* Added sample code definitions