class optimization