optimizing recent history localStorage
adding try/catch around localStorage