Added ability to dump to file directly, use '--tofile'