Offline capabilities added. Need to clean up the code.