factor an abstract class into a trait