Shuffled the function flatten around