added offline functionality