Version with traits instead of inheritance