refactoring, some new small features