The indent of lines 284-286 seems wrong (but somehow I can't seem to add a comment there...).