Added greatest common binding algorithm