added whitening code