changed filename from input rather than constant

now takes a user input for the filename, rather than using a global
constant. Also improved exception handling, and housekeeping