cleanup, removing some commented code, some global variables and hacking the IdentityMenu to keep it semi-functional without the globals