```python
def reverse_vowels(str1):
    """
    Reverses only the vowels of a given string.
    """
    vowels = "aeiouAEIOU"
    char_list = list(str1)
    
    left = 0
    right = len(char_list) - 1
    
    while left < right:
        # Move the left pointer forward if it's not on a vowel
        if char_list[left] not in vowels:
            left += 1
        # Move the right pointer backward if it's not on a vowel
        elif char_list[right] not in vowels:
            right -= 1
        # If both pointers are on vowels, swap them and move both pointers
        else:
            char_list[left], char_list[right] = char_list[right], char_list[left]
            left += 1
            right -= 1
            
    return "".join(char_list)

```