Look up basename using already split segments

Previously path.basename was used in conjunction with joining
and splitting the segments array which was much slower than just
looking up the basename from the already split segments array.
Rename splitFile to filename
Expand comment