Less code for renderObjWithClass().