Changed ListBuffer to mutable.Set (thanks to @xuwei-k)