Impurities in noncubic crystals: stabilization mechanisms for Jahn-Teller ions in layered perovskites.