More robust handling of note lengths