Added javascript implementations of some of the functions