added todec function