working on io direction; may have errors, dont remember where left off