Made DynamicArray use references instead of copies.