offline logic