added input and parsing code