CodeBook implementation