added offline support