Added input validation

Added input validation