method name and code structure modified to retrieve the classname.