Updated README. Added tests and fixed trivial issues in code (engine.js).