Fix severe shadow slowdown, remove debug code