Optimizations

Mostly ensuring monomorphic calls in some places, but also some algorithmic cleanup