Added flag support for -warning -email
Simplified the main function, and made sure warnings/emails worked properly