extract out core logic into esrislurp ref #29

ref #29