moved filtering of children to where it's actually used