Passing contexts and fixed membership bug

fixes #30 and fixes #31