middle-out implementation

Vedi bottom-up implementation.