Isolated the mo.js library in its own file and moved extra code elsewhere