Refactored MPM. Race condition bugfixed.