clean code
fixed validate()