added js factories
2nd edit