add utility code for supporting various kinds of input