Original copy from getnomi repository.