Re-implemented the menu code. Fixes #27