functions that implement IO