Add tests for transpose and cleanup kernel code.