small optimisations to match functions & sum

Mangaged to decrease runtime to ~75% of what it was with some simple
optimisations. md5sums of output appear the same
version bump