changed mapM_ to mapM