added extensive comments to checkValid.js