implement some functions of lpa (copra version).