Implementation of the GHS algorithm