##Added logging and made persistence more relieable... Please test!!!