Stable implementation (before GADTs)