Improve class name parsing