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().
Merge pull request #1211 from credomane/patch-1

Added support for nested sub-menu. Fixes #1210