part of input and output functions finished