ticket:6 Fixed javascript, added tests