added user-settable sampling rate