added some more math functions
fixed up the mesh and added "reference count"
updated makefile to work with c++
worked with c++