Improved the effectivity of the character handling's code