improving on the prettifyCodeSnippets function