Added toArray tests and method