Move volume name handling to separate function