refactoring and new features