Take refresh parameter into account and make it per device, not per plugged device. Fix #32.