Refactoring. Removed complete task functionality out of edit loop and into method.