Clean up and document IO.pm