input function improved