Replace most parts with Kotlin equivalents