Fixed some logic bugs
Optimized for debugging (cleaning localStorage)