Updating with a bit more logic around detecting input devices as well as a bit of cleanup