replace two scan implementations with one
build js