added ruby and c implementations