Refactoring to favour composition over inheritance