Added user defined file input

Added user specified file input back into the code.  Also rearranged the code a bit so that an out file is not created if the user doesn't enter a filename.