Add fs.Stat functions and test them. Refactor some helper bits.