fixed save issue

and some formatting improvements.