This commit passes all the eunit tests but it generates errors about corrupt headers. Needs more work but pushing it for now.