pull some readreplay functions out into funcs.py