Code of pmf optimized