Fixes to while loops in functions. If statement not working in 'while test2.ham'