switching over the gateway for multiple jobs
added some mongodb functionality in the main files