removed a helper method for a better pure ruby implementation