Fixed stupid bug letting the closest gate method fail.
Additional work for Issue #8