Changed file validation to new dir

Also, simplify some functions.