This is repeated a couple places (basing String output type off of an input). Worth pulling into a common helper?