Changed mapM_ to forM_