Added some code from c domain