added the logic for the results