Finished adding *A and *BA encode functions.