Made sample size adjustable during runtime.

Also added a slider for changing it on the fly.