Applied minor refactorings
Exposed flattenList() to use it from external classes