Replaced if statement by trait function call.