This assumes dates is an Array or Hash. You should raise an ArgumentError if they are not. (Also add specs)