Js refactor ingest