m2
added code for calculating characters