support passing flags from js
worked out API