refactored processed item logic