Adding toArray method
Adding asArray option to contents method
Adding tests for asArray