refactor of update_related