One other thought. Asking the user "what they want to do" and "what is on now" will get you through a lot of decisions and get you past the missing discretes. It is a bigger programming job but it works great for me.
Dave D'Arche
Dave D'Arche http://RemoteQuest.com Fine Home Theater Remote Controls & Solutions - Programming services for most remotes