added implementation in D
added implementation in D