cleanup and don't split up stdin (figure out a cleaner way of doing that)