refactoring of select input