based on scala-12