Cleaned up Task code