Build curved tabs only once document is complete

This looks like something that will be used in several places and should go in a utility module.