Rewriting the sample application