refactored workFlow