implement it in ruby