Moved code out from vanilla.js to small modules.
Moved code out from vanilla.js