Refactored code into interfaces