Shouldn't this be part of the condition on line 90? - then you're not repeating code?