Added file output funcitonality