[yanan] refact the tasks code