copied existing js module as starting point