Improve tagged union construction