From llh1 master branch