Just a minor nit: If you're going for a builder pattern here, usually the methods are named `withXYZ`, so it would be `withK`, `withMaxIterations`, etc. Usually setters in Scala take the form `def maxIterations_=(maxIterations: Int) { _maxIterations = maxIterations }` and don't return `this`.