Added validation functionality, especially of user-input.