Minor code improvement

Reduce if- else on function countMenuChildren()
Reduce if-else on function render()