Add rudimentary conditionals around undefined element positions