IMHO this should be moved to io.php