Copied lesshat to lib.