move compare to seperate function.