refactored workflow