Implemetation using C