Replaced repeating code for a trait