Changing from Python to Ruby