Phil pipeline rewrite into Python