added window on samples formula calculation