Add more comments of KMP in the code
Refactoring the code