improve the traits code