Minor attempts at speeding up stuff.
Bugfixes.