I thought you might find gchiu's approach interesting: http://www.emrupdate.com/forums/p/17606/91968.aspx#91968