Do not call basename 3 times