changed polling to interrupts and added possibility to set speed