Implemented validate() method