Trying to get the persist function to work better