move prep + helpers to util, use prep in split-input