refactored _setClass nethod