work version, refactoring