Build Menu Structure, Refine error dialog and root node placement
Code format updated