Simplified the code to flatten

I hope this doesn't seem weird, but I randomly saw the project (somebody starred it in my news feed) and since I've done something similar I knew a different method to flatten an array.