working out the js