Add space after "switch" and "while" before "(", as per PR review

Fix it everywhere while I am at it