final sample app code