js and index changes for validation