done checking cluster mongodb in script +Refactoring