comment for runTask function, added check for type of task