Added offline code as well