add pure ruby implementation