Move type logic into the backends