Refactor a bit and add child module discovery