Added data validation subroutine