Refactoring and adding new features