Cleaned up fileio and made it usable.