replaced idb by fileapi implementation