results output and code cleanup