added code for input and working ok