Simplify: less state, less records, more pattern matching.