commit function works