Ensuring path is switched back at the end of the task.
Switched to exception model from return codes.