split msgemitter out, more tests, added index for scope and resource