cleaned up disk i/o code