Added functions for edit distance 2