adding the verification code, verify the sorted results by performing some checks