improve implementation to include parents