implemented composite pattern