commit logic