add documentation, reorganize ffi, and add CPG#connect method