another new version
With refactoring