refactoring and extra features