twi: some size optimizations