Refactoring to have a common context for ids and stuff