Make menu buttons work, and fix a couple of issues with the previous manual merge