button hell

It looks to me as though you are reading the buttons and if you find one of them pressed you are acting upon that press. Whilst that sounds OK think what happens if the button remains pressed after the actions are complete. They will, of course, repeat. What you need to do is to act when a button becomes pressed rather than is currently pressed. There is a state change detection example in the IDE.

Incidentally, why do you have a while loop that will never exit in your code ? As far as I can see, once the getPin() function is called it will never end.