almost finished - inputs have to be put back, some more outputs maybe as well