Added online checks and started working on offline mode