added offline mode and DB cache