added tables, and changed email functionality