refactoring of bind into input function