Modularised factories.js into seperate script files