Implemented defer functionality which allows long running tasks to give other tasks time to execute. Implemented test to showcase this functionality.