review code masterAgent.js