Fixed bugs, added tests and examples, generated package.json