refactor PCs and UniDocs code