Fixes, cleanup so that both IO and file input work.