adding back condition withing the comparing function