switched to built-in functions in js, added more TODOs, some tests rewritten