Added file io thread, random changes, additions, and bug fixes.