Added toArray() and isEmpty() methods.