refactor commit()