Change validate to a class method

which might be the fix for #7