Java to Kotlin converter: better and more correct code