refactored version

refactored version