Now using foldM for creating the arrangement