incorporated the returning of results in run processing function