Moving debug output before handling of task completion to ensure output is displayed in case of errors and to serve as context prior to the success statement.