Added WorkItemComplete logic, more refactoring.