added file saving, requires file type be designated