While loop works

while function works, however only for tabs, working on a different
version now