Improving email functions