Ported the Chapter class to scala.