Added conditions in case of equal values too, still can't find error with/without the equal value if conditions!