"Beginning" in this example is not a gerund, but a participle.
This sentence is an example of how a participle phrase (in this case, how two participle phrases connected with "and") can be used as an adverb in a sentence.
More precisely, it is an example of using a dangling modifier (dangling participle is just a special case of dangling modifier) in a sentence as an adverb modifying the sentence in general. In most of cases dangling modifiers are considered to be mistakes, but there are exceptions, such as in your example.
There is a mentioning of it in the wikipedia article about participles.