Cleaned up PMM code