it turns out that this way uses a LOT of memory