Moved worker helper subroutines to a separate package so that they can be reused more easily