cleanup some embedded PHP; still untested (I'm on a train)