finished JS-to-PFA example