refactors the building io file to separate functions