Validate input value and add missing piece of code