working on Offline and online detection and stuff