Refactored validate method

Signed-off-by: George Gastaldi <gegastaldi@gmail.com>