fixing a few stylistic issues and implementing ExpressDef caching on root patient context