Minor code improvements after conversion to Kotlin