Closes #671. Pulling in @rjmackay's validation fixes.