Fixed bugs

fixed a few bugs that were causing the email not to send properly. As
well as switched to sessions to allow passing of data