calculate more stuff
moved unique samples to a function