Simplify implementation of smartBaseName