Modifications in the LM Manager script; separated the part for eliding the target string and handling edges