Move store and records declarations

I moved store and records declarations as otherwise things get out of sync when you call LocalStorage.clear().

And added a simple patch implementation.