Updated to fix input validation.