update codebooks

merge p and b
update p codebooks
merge p and b codebooks
fix output residuals method