created separate class for the functions a and b