added code to optionally ignore first block  and make sure that there is no invalid file type