Fixed new task creation. Did some cleanup.