Integrate validsig, related refactoring and utility updates.