Major refactoring of Tasks

Change-Id: Idd0da65c7e6cda06f266394a40b9da0695bcb81f