added more functions to allow saving files