Moved in-memory database to lib/gateways.