commit function