Fixed current code to use the localStorage factory