Made changes to support offlinw mode / local database baby steps