Switched to using fileinfo methods. This is cleaner and more
bug-proof.