speedups by removing debug if's