Extract menu setup code