[Ch2] Add input validation