streamlined code in update_pos