Multiple fixes, improvements and massive speedups.