simplified localStorage vs. sessionStorage management
fixed a bug: callback rised an exception if not defined
multiple versions: WIP