Fix async races and no jquery

swapped $.deferred() with JS Promise API. Made more promises to deal with async indexedDB api.