refactor dataMngr.js to eliminate global variables