refactored / simplified