removed extra print statements; added -o option for file output