I think you could just replace `NAME` with `NAME_WE` above. Especially since you didn't handle `.a`.