Added isValid functions.