Optimization of 2×2 MZI electro-optic switch and its application as logic gate