cleanup of valid.js