change the update method to thread