Simple speed improvement to #31