Small code restructure so that coverage sees that all conditions are tested