updated to also set and delete the localStorage