parsing input and output