Ow

Never again. Generalized the code to take arbitrary amount of samples.