Added ElementFactory tests. Fixed a few PNP problems.