refactoring for midi device input