added mongodb and control functions