put name trimmer in a function