Replace main func with new save implementation.