The following bits need explaining or removing. It's not clear either what this portion is actually doing and what the utility of the extra test and complexity is.