clean up menu code and make it work for keyboard