Added function to search for windows