changed saving mechanism