extract out core logic into esrislurp ref #29