Switched from .c to .cpp, added C support