use built in methods to write to userdefaults