initial coding of KMP