Refactored existing code