Used a better type parametter name.
Add flatten trait.