working on on/offline functionality