Updated JS menu logic to use Object