improving bbcode algorithim