refactored bbcode helper
fixes bbcode test cases