modify legacy n5 and n7 to kp and lp in order to improve generality