Small optimization by using ArrayBuffer instead of ListBuffer.