Changed iterates from Seq to mutable.Buffer