improved js api