Added conditions for casting numbers and handled underscores in class names appropriately