Further changed how the IO handling is done

#21 #17 #16 #11