And also, probably tidier to stop using all of these local vars and switch to just using $this->options['debug'] etc everywhere else, clearer they came from options.