Cleaned up code and fixed mailgun integration