Added more features and input validation.