Added code to provide undersampling.