Huge speed improvement, several fixes.