refactor to support multiple contexts, the existing Manager and Pool interfaces were preserved