Please double check all uses of `self.` in this file - it looks like there's a bunch that will access undefined variables.