Added method that takes character set as a parameter