updated savefiles function to work with styles too