basic codebook recognizer
complete draft