Refactor: use scala.collection.mutable.{HashMap, HashSet}