diff --git a/kotlin/simple-cipher/src/main/kotlin/Cipher.kt b/kotlin/simple-cipher/src/main/kotlin/Cipher.kt
index 4018bed..e720dac 100644
--- a/kotlin/simple-cipher/src/main/kotlin/Cipher.kt
+++ b/kotlin/simple-cipher/src/main/kotlin/Cipher.kt
@@ -26,7 +26,11 @@ class Cipher() {
         val stringBuilder = StringBuilder()
 
         for ((index, i) in s.withIndex()){
-            stringBuilder.append(i + (key[index].toInt() - 'a'.toInt()))
+            var charToAppend: Char = i + (key[index].toInt() - 'a'.toInt())
+            if (charToAppend.toInt() > 'z'.toInt()){
+                charToAppend = charToAppend - 26
+            }
+            stringBuilder.append(charToAppend)
         }
 
         return String(stringBuilder)
@@ -37,7 +41,11 @@ class Cipher() {
         val stringBuilder = StringBuilder()
 
         for ((index, i) in s.withIndex()){
-            stringBuilder.append(i - (key[index].toInt() - 'a'.toInt()))
+            var charToAppend: Char = i - (key[index].toInt() - 'a'.toInt())
+            if (charToAppend.toInt() < 'a'.toInt()){
+                charToAppend = charToAppend + 26
+            }
+            stringBuilder.append(charToAppend)
         }
 
         return String(stringBuilder)