my brain is broken

problem code is uncommented, somewhere between lines 260 and 308. Sigh.