input function modified