Added commit method + abstract serialize function.