Added tools for generating A
Added testing code
Several style modifications in CG