c++ized and added shapetool/shape support