First pass implementation (flattened).