moved functions into classes, and cleaned up mail function. also added integerfield, and message flash