refactored accounts manager and emailer to use exceptions and better IN sql