Idtable scope

I merged @gergeley_ujvari's work with my pull requests from before (no underscore). Should merge cleanly. I verified that the test is a failing test and the fix is the fix.