Added dialog visibility checks and cleaned code
Fixed blank winDialog issue #31 for real