Separated io from main.