working version before refactoring the input routine
refactored to push the input prompt into a function.