Refactor shortcode() method into two additional protected methods.