General (1,d-1) code working