Refactor main JavaScript object MK