Updated application code

Reviewed and fixed application code for peer review.