Implementation of Composite design pattern