Created functions for read / write loops.