Input validation and decision making