Restructured the logic here somewhat.  This is a combination of what used to be on lines 194 - 198, but with None checks ensured.