Added Save As option and also added the option to open files (also tidied up code a little bit)