Revised io

need to merge this to my branch