Added file saving and format methods

and tidied code.