Modularizes menu code and sets up a Stmx global object. Create a menu for language switching

See discussion in issue #471