Additional modularization, misc. resource test fixes. Updates to populate sql script from mainline.