Factor out argument parsing
Fix and simplify pull logic