removed director.js, moved its methods to factory.js
refactor, correcting errors