Moved token check into while loop instead
Mmmmmmkay... wall of red rewrite! :)