make dic code more flexible