This looks great (if initially a little complex).