Input validation added