seperated the production and local code
tweaked for production level code