Simplify internal code for expanding library paths