First mostly-working PFM version