Completly refactoring c code to wrap c++ code (issues #1 & #8)

> keeping (mostly) the same interface for external callers
>> the python code won't have to change too much

> This was painful.