switching from ArrayBuffer to ListBuffer to improve performance