added more checks to the file