Added theta_e function