Added getLastSegment() method
Added getFirstSegment() method
Added documentation for getFirstSegment() and getLastSegment()