Synthesis of substituted hydroxy benzimidazoles, benzisoxazoles, benzothiazoles and related compounds