Moved feature comparison code to its own function