AE: Get the samples as a const reference rather than as a copy
AE: Also change the sample iterator to const