Refactored  findCloseLines and removed unused code.