refactoring the application code