Major restructure of emweb.js.
Wrote basic test.