Simplified and fixed up the POSIX I/O.