Code for sample application.