Move code-writing to separate notebooks and add PN-order support