added option to normalize the sample