simplified flatten according to the solutions