added indexeddb saving when code executes