Added invalid chars validation

- code refactoring
- modified validate method signatures