Changes to use a single store instance between invocations.
Moved to the api module.