Improved page resource management and added check on source doc. type and version.