Added checking for task blocked.
Also added tests for testing it.