Added getClassByParameter() function
Refractored code