refactoring and improving existing code