New functions

Now, the Sharedpreferences are in functions