Implemented commit logic