Factor out IO reading resposibilities
Remove debugging code