added on finding whether line is selected, not done