Implementing  composite pattern