Merge pull request #1 from dsherida/master

converted from c++ to c, updated structures and methods