Implemented commit function