Replace anonymous inner classes with native inheritance where possible (saves objects)