Implement lazy flatten()