Move compare code into its own function and rename option