Refine build-lhs.py