new features and refactoring