cont. refactor on menu and added environment check in template