Reformat code
Add save function