add add and commit function