core functions for parallelization