what does a pulse generator do