proper generation of internal classes