Finished AGMBD code generation