Localstorage cleanup

WIP, do not merge yet.