moved the update prep code to keep it DRY