added basic mailing and cleaned up a bit