Improve class menu code