Attempting to rewrite illegal file check into legal file check

It's not working so well right now. :\