Improve typedef handling