implement the add_work function