added length normalization