optimize class