insectionlines refactor and tidy up