Use foldl and less silly init pattern