some cleaning up in ply.js