Add an option to change the sample window size on the fly.
Clean up.