What is the version of the following sentence with correct punctuation?

The fairy tale often follows a formulaic theme building on the repetition of rituals and phrases
The fairy tale often follows a formulaic theme, building on the repetition of rituals and phrases.