solution to flatten added