Fixed the greaterThan issue, algo maybe not correct