Extracted from Filelib.