refactored small functions into helpers.py from util.py and elsewhere; made psearch work