Clean up and updated CodeBook with pre processing