Various fixes, mainly speed fixes.