Update the whole API to better fit with javascript