Added offline working functionality