Should we try to write some tests around this class?  It looks pretty good to me but it seems like there is a lot of logic in here.