Improved gulp tasks and refactored some js files.