Refactor to wrap all the messy direct drive IO code in a class.