moved compare sub out of validation