refactoring according to the new version