Added significant error checking to verify files existence and formatting