refactor of plcmp