switch to InputStream architecture, not done yet

IT’S NOT TOTALLY WORKING!!