The lines you removed where considerably more performant and created a lot less hashes and intermediary objects then the two new ones. Could you rewrite this a bit to be more similar to the previous implementation?