Formation and after-treatment of dielectrics