Added James Nunez's code from: http://sourceforge.net/projects/mdhim/