Refactor #child and add tests
Increase readability and add unit tests against #on