Added more file validation