added autosave parameter, pretty laggy, maybe will delete this in future