Add logic for line begin handler