refactoring and new version