Little API simplification, add MemDir class + example using it.