code refactored and optimized, modified to reflect Kotlin plugin 0.8.425, IntelliJ IDEA 14, and kotlin-SNAPSHOT runtime (see build.gradle for details)