changes from Michael Goddard / PHD & HAWQ