please remove these two 'flatten' calls