Adding `flatten' to flatten a nested list