Do proper error check for the existence of input files
Implemented proper error checking on the profiles