written in C and possibly D