use win variable instead of using global window