factor CamelCasing code out to a function