Refactoring callbacks.

Cleaning localStorage from invalid data.