fixed bug isWondowd and added several comments