Fixed applyBase test
Extracted flatten to flatit module