Fixed errors when no active menu item #262
Some refactoring in preparation for other views