add the logic for better or lower

add the logic for better or lower