Validation

Added better validation functionality