refactored a lot of code after finding bug in component root querying