modified to add new GMD algorithm