introduce window range as parameter