function traits refactor