replace class defination a wiser way