changed environment global and hook into db