Renaming local variable 'window' to 'win' to avoid global/local confusion.