Minor changes
Removing unnecessary variable
Changes related to creating one combined data i/o procedure