Added support for nested sub-menu. Fixes #1210

Removed the loop from menu() and replaced it will a call to menuBuilder().
Added menuBuilder() function containing a modified version of the loop from menu().