abstract out process functions