improve handling of rests
more tweaks; back out accidental change for now