added the commit function.