Migrate code examples to Scala classes