javascript WIP: improved api