refactored to leverage existing get input function