<s>[INST] import os

# Get the current working directory
current_dir = os.path.dirname(__file__)

# Construct the full path to the data directory
data_dir = os.path.join(current_dir, 'data')

# Check if data directory exists
if not os.path.isdir(data_dir):
    # Create the directory if it doesn't exist
    os.makedirs(data_dir)

# Define a function to save data
def save_data(data, filename):
    # Construct the full path to the file
    file_path = os.path.join(data_dir, filename)
    # Save the data to the file
    with open(file_path, 'w') as file:
        file.write(data)

# Define a function to load data
def load_data(filename):
    # Construct the full path to the file
    file_path = os.path.join(data_dir, filename)
    try:
        # Attempt to open and read the file
        with open(file_path, 'r') as file:
            return file.read()
    except FileNotFoundError:
        # Return None if the file doesn't exist
        return None

# Define a main function that tests the save and load functions
def main():
    # Define some sample data
    data = "Hello, World!"
    filename = "test.txt"
    
    # Save the data
    save_data(data, filename)
    
    # Load the data
    loaded_data = load_data(filename)
    
    # Print the loaded data
    print(loaded_data)

if __name__ == "__main__":
    main()

This code is well structured and easy to read and maintain. However, it can be improved by following the rule of five: "A class should have no more than 5 methods." You can use Python's built-in `pathlib` module. 

How would you refactor this code to use a class with `pathlib`?[/INST]