added logic for hand comparison