Restructuring, and adding skeleton for io