add asArray() and validate() functions