moving some functions to io.jl