in reply to cached problems
You have the sense of the test in the if statement on line 42 backwards.