C Implementation.
added more types