finished transpose, several grid optimizations