first draft (probably very buggy) of GROUSE algorithm.