Modification of sdsern's patch to address radix's review comments

Addressed issues raised by radix in [comment 20](https://twistedmatrix.com/trac/ticket/5476#comment:20) regarding [patch submitted by sdsern](https://twistedmatrix.com/trac/attachment/ticket/5476/5476.patch).