refactor'd data bag search code for application deploy