Modularized parts of process function