implemented validate method