This invention provides potassium channel modulators which are compounds of formula I where at least one of W and Z is N; where the moiety is one of Groups A or B below A where Ar is a 1,2-fused, six membered ring aromatic group, bearing substituents R1 and R2 as defined below, and containing zero or one ring nitrogen atom; and where other substituents are defined herein. The invention also provides a composition comprising a pharmaceutically acceptable carrier and at least one of the following: i) a pharmaceutically effective amount of a compound of formula I and ii) a pharmaceutically acceptable salt, ester, or prodrug thereof. The invention also provides a method of preventing or treating a disease or disorder which is affected by activities of potassium channels, comprising administering to a patient in need thereof a therapeutically effective amount of a compound of formula I or a salt, ester, or prodrug thereof.