Addtl. output function, file logic and code cleanup