Move trait mapping to an fn