Refactored menu links code