added check for local storage to prevent overwritting older data that already exists