[WIP] Implementation of PME

work in progress