Email and other functionality now working, fixed various discovered errors