Refactored to modularise controller.js into seperate script files