Added document validation