Copied from legacy elib repository