reduce the number of stat() calls
further reduce the number of stat() calls
reduce the number of stat() calls even further