refactored the Application code.