Fixed some bugs with the generic wrappers and added code for the building of the graph