Reattach comments to the correct statement.

It felt lonely without them.
validate_input(): security fix.

Always validate all user input, especially if it is used in calls to
exec(). Otherwise, your code may turn into a strainer.