Replaced flat_map with sum.map to work on ruby <= 1.9.1 (#59)