Moved io function to API

All moved for the sake of cleanish look.