use failIf to condense these big if trees a little more