added a couple more JS APIs and removed some debug code