Add a validation facility and tests, and switch over to new resource framework.